import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PerformanceTargetDetailVO, PerformanceTargetDetailForm, PerformanceTargetDetailQuery } from '@/api/performance/performanceTargetDetail/types';

/**
 * 查询业绩目标完成度明细列表
 * @param query
 * @returns {*}
 */

export const listPerformanceTargetDetail = (query?: PerformanceTargetDetailQuery): AxiosPromise<PerformanceTargetDetailVO[]> => {
  return request({
    url: '/performance/performanceTargetDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询业绩目标完成度明细详细
 * @param id
 */
export const getPerformanceTargetDetail = (id: string | number): AxiosPromise<PerformanceTargetDetailVO> => {
  return request({
    url: '/performance/performanceTargetDetail/' + id,
    method: 'get'
  });
};

/**
 * 新增业绩目标完成度明细
 * @param data
 */
export const addPerformanceTargetDetail = (data: PerformanceTargetDetailForm) => {
  return request({
    url: '/performance/performanceTargetDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改业绩目标完成度明细
 * @param data
 */
export const updatePerformanceTargetDetail = (data: PerformanceTargetDetailForm) => {
  return request({
    url: '/performance/performanceTargetDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除业绩目标完成度明细
 * @param id
 */
export const delPerformanceTargetDetail = (id: string | number | Array<string | number>) => {
  return request({
    url: '/performance/performanceTargetDetail/' + id,
    method: 'delete'
  });
};


/**
 * 同步领星接口
 * @returns {*}
 */
export const syncData = (query?: PerformanceTargetDetailQuery) => {
  return request({
    url: '/performance/performanceTargetDetail/syncData',
    method: 'get',
    params: query
  });
};